/**
 * 对应关系
 */
const MAP = {
    "崇皇街道": "CHONG_HUANG",
    "渭桥街道": "WEI_QIAO",
    "泾河街道": "JING_HE",
    "鹿苑街道": "LU_YUAN",
    "通远街道": "TONG_YUAN",
    "耿镇街道": "GENG",
    "张卜街道": "ZHANHG_BU",
    "姬家街道": "JI_JIA",
    "药惠街道": "YAO_HUI",
    "马家湾": "MA_JIA_WAN"
}




/**
 * 获取详细信息
 * @param {String} fullAddress 
 * @param {String} province 
 * @param {String} city 
 * @param {String} district 
 * @param {String} townShip 
 */
function getDetailAddress(fullAddress, province, city, district, townShip){
    let str = `${province}${city}${district}${townShip}`;
    return fullAddress.replace(str, '');
}



/**
 * 匹配对应关系
 * @param {String}} townShip 
 */
function getJurisdiction(townShip){
    return MAP[townShip] ? MAP[townShip] : "不存在";
}

//获取表字段
function generateTableKeys(tableData){  
    return tableData.map(i => i.key).toString();
}

//获取表值
function generateTableValues(tableData){
    return tableData.map(i => i.value).toString();
}


module.exports = {
    getDetailAddress,
    getJurisdiction,
    generateTableKeys,
    generateTableValues
}